import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class CustomPaintDemo extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('CustomPaint'),
        centerTitle: true,
      ),
      body: CustomPaint(
        painter: MyPainter(),
      ),
    );
  }

}

class MyPainter extends CustomPainter{
  late Paint _myPaint;
  @override
  void paint(Canvas canvas, Size size) {
    _myPaint=new Paint();
    _myPaint.color=Colors.blue;
    canvas.drawCircle(Offset(100, 100), 100, _myPaint);
    _myPaint.color=Colors.red;
    canvas.drawLine(Offset(200, 200), Offset(300, 300), _myPaint);



  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) {
    return false;
  }

}